<template>
  <CardItem
    title="合同待审批"
    :num="num"
    :icon="icon"
    @goMore="goMore"
  />
</template>

<script>
import { message } from "ant-design-vue";
import {
  defineComponent,
  reactive,
  ref,
  computed,
  watch,
  toRaw,
  toRefs,
} from "vue";
import utils from "@/common/utils/utils";
import request from "@/common/utils/request";
import CardItem from "@/views/home/components/CardItem.vue";
export default defineComponent({
  name: "contractApprovalCard",
  components: {CardItem},
  props: {

  },
  setup(props, context) {

    const state = reactive({
      num: 0,
      icon: utils.staticPath + `images/workbench/approval_contract.jpg`,
    });

    const getApprovalList = () => {
      request.post("/org", '/workbench/approveList', {
        page: 1,
        limit: 10,
        list_type: 'type_2',
      }).then((res) => {
        state.num = res?.total || 0;
      });
    };

    getApprovalList();

    const goMore = () => {
      window.microApp.forceDispatch({
        type: "SetMicroPages",
        microInfo: {
          microId: 'org_workbench_contractApprovalList',
          app: 'org',
          name: "合同审批列表",
          url: '/contract/contractApprovalList?noBack=1&type=type_2',
        }
      })
    };


    return {
      ...toRefs(state),
      goMore,
    };
  },
});


</script>

<style lang="less" scoped>

</style>
